package ids.dev.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import ids.dev.util.IDSStringUtil;

@Entity
@Table(name = "ids_group")
public class Group implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="id")
	@SequenceGenerator(allocationSize=1, initialValue=1, sequenceName="group_id_seq", name="group_id_seq")
	@GeneratedValue(generator="group_id_seq", strategy=GenerationType.SEQUENCE)
	private Integer id;
	
	private String name = IDSStringUtil.STRING_EMPTY;
	
	@ManyToMany
    @JoinTable(name="group_has_sysuser", joinColumns={@JoinColumn(name="group_id")}, inverseJoinColumns=
      {@JoinColumn(name="sysuser_id")})
	List<SysUser> members;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<SysUser> getMembers() {
		return members;
	}

	public void setMembers(List<SysUser> members) {
		this.members = members;
	}


	
	
}
